package lapsnake.model.misc;

import lapsnake.model.bounceback.StringNode;
import lapsnake.model.data.*;
import lapsnake.model.*;
import lapsnake.model.expr.LapName;
import lapsnake.py.ast.ASTHelperFactory; import java.beans.PropertyVetoException;

import org.python.antlr.ast.*;

/**Wrapper class with helper functions for arguments nodes*/
public class LapArguments extends LapNode {
	protected final ChildList<LapExpression> args = new ChildList<>(this, LapExpression.class, true);
	public final OptionalChild<LapName> vararg = new OptionalChild<>(this, LapName.class);
	public final OptionalChild<LapName> kwarg = new OptionalChild<>(this, LapName.class);
	protected final ChildList<LapExpression> defaults = new ChildList<>(this, LapExpression.class, true);
	
	public LapArguments(PyAST pyAST, ChildField<? super LapArguments> parent, arguments node) throws PropertyVetoException {
		super(pyAST, parent, node);
		
		ASTHelperFactory.makeHelpers(pyAST, args, node.getInternalArgs());
		ASTHelperFactory.makeHelper(pyAST, vararg, node.getInternalVarargName());
		ASTHelperFactory.makeHelper(pyAST, kwarg, node.getInternalKwargName());
		ASTHelperFactory.makeHelpers(pyAST, defaults, node.getInternalDefaults());
		
		buildTextNodes(node);	
	}

	public LapArguments(PyAST pyAST, SingleChild<LapArguments> parentField) throws PropertyVetoException
	{
		super(pyAST, parentField, null);
		
		setTextNodes(new StringNode("(")); //uh.
	}
}
